package com.sinodata.bsm.center.engine.event.worker;

import com.sinodata.bsm.center.bean.ResBean;
import com.sinodata.bsm.center.engine.event.EventWorker;
import com.sinodata.bsm.center.engine.resource.health.ResHealthEngine;
import com.sinodata.bsm.common.constants.EventConstants;
import com.sinodata.bsm.common.vo.Event;

/**
 * 
 * <p>
 * Description: 事件处理工作流：更新资源状态(健康度状态)
 * </p>
 *
 * @author liulibo
 * @version 1.0

 * <p>
 * History: 
 *
 * Date                     Author         Version     Description
 * ---------------------------------------------------------------------------------
 * 2012-5-25 AM 10:58:31    liulibo        1.0         To create
 * </p>
 *
 * @since 
 * @see
 */
public class ResourceStatusWorker implements EventWorker {

    public ResourceStatusWorker() {

    }

    @Override
    public void execute(Event event) {
        //如果是新事件 但被过滤掉 跳出不处理
        if (event.getCatalog() == EventConstants.CATALOG_FAULTEVENT && event.getConfirmType() != null && event.getConfirmType() == EventConstants.CONFIRM_TYPE_FILTER) {
            return;
        }
        //如果是健康度事件 不用再次刷新状态 跳出不处理
        if (event.getCatalog() == EventConstants.CATALOG_USABLEEVENT) {
            return;
        }

        //产生事件后刷新 资源状态 add by wangyl on 2012/7/9
        ResHealthEngine.getInstance().refreshResFromChild(ResBean.get(event.getResId()).res());
    }
}
